<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<title>公寓大赏</title>
<link href="__PUBLIC__/index/css/apt.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="__PUBLIC__/index/js/jquery-1.8.1.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=7QZaD80e6MZCRY4jXjM5lXRWpfg5R1m1"></script>
<script type="text/javascript" src="__PUBLIC__/index/js/apt.js"></script>
<script type="text/javascript">
wx.config({
    debug: false,
    appId: "{$arr.appid}",
    timestamp:"{$arr.timestamp}",
    nonceStr:"{$arr.noncestr}",
    signature:"{$arr.signature}",
    jsApiList: [
        'getLocation',       
      ]
});
	 

//隐藏微信右上角
wx.ready(function () {
	$cid="{$cid}";
	if($cid==""){
		 gpss();
	}else{
		$(".gps_fixed").text("{$cname}");	
		$(".gps_fixed").attr("link","{:U('Apt/cas')}?cid="+$cid);
	}
     
   function gpss(){
 		
  wx.getLocation({
    type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
    success: function (res) {
        var latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90
        var longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。
        var speed = res.speed; // 速度，以米/每秒计
        var accuracy = res.accuracy;// 位置精度  
       	var geoc = new BMap.Geocoder();  	
 		var point = new BMap.Point(longitude,latitude);        
		var pt = point;
		geoc.getLocation(pt, function(rs){
			var addComp = rs.addressComponents;
			var province=addComp.province;//省
			var city=addComp.city//市
			var newcity=city.replace("市","");	
			var url="{:U('Apt/cityid')}?name="+newcity;
			
			$(".gps_fixed").text(newcity);	
			
			$.get(url,function(obj){
				if(obj.s=="true"){
					listcity(obj.m);
					$(".gps_fixed").attr("link","{:U('Apt/cas')}?cid="+obj.m);
				}
				 
			})
			
			
		});       	
    },
    fail: function(res) {
			var url="{:U('Apt/cityid')}?name=上海";
			$(".gps_fixed").text("上海");	
			$.get(url,function(obj){
				if(obj.s=="true"){				
				listcity(obj.m);
				$(".gps_fixed").attr("link","{:U('Apt/cas')}?cid="+obj.m);
				}
				
			})

	}
    
}); 
 }
 
 
 function listcity(m){
 	$url="{:U('Apt/gpslist')}?id="+m;
 	$.getJSON($url,function(obj){
 		if(obj.s=="true"){
 			$list=$(".gpslist");
 			$list.empty();
 			$listval=eval(obj.m);
 			for(var i=0;i<$listval.length;i++){
				var html="<li class='link' link='{:U('Apt/show')}?id="+$listval[i]['id']+"'><img src='"+$listval[i]['src']+"' /><div class='ce'><span><div class='font_1'>"+$listval[i]['name']+"</div><div  class='font_2'><div class='font_2_txt'>"+$listval[i]['map']+"</div><div class='font_2_bg'></div></div></span></div></li>"
				$list.append(html);
			}	
 			initClick();		
 		}
 	});
 	
 	
 }
});



</script>
</head>
<body>
	<div class="form">
		<div class="gps">
			<div class="gps_b link"  link="{:U('Apt/gps')}"></div>
			<span class="gps_fixed link" link="{:U('Apt/cas')}" >定位中</span>
			
		</div>
		<div class="key">
		<input  type="text" name="key" id="key" placeholder="输入小区名或关键字开始看房咯！"/>
		<div class="button"></div>
		</div>
	</div>
	
	<div class="list" style="padding-top: 50px;">
			<div class="beader">
				<ul class="ul">
					<volist name="barder" id="src"  key="$key" >
					<li class="link" link="{$src.url}"><img src="{$src.src}"/></li>
					</volist>   
				</ul>
				<ol id="num">
					<volist name="id" id="id"  key="$key" >
					<li db="{$id.id}" ></li>
					</volist>   
					
				</ol>
				<volist name="ms" id="ms"  key="$key" >
				<div class="font_3 {$ms.id}">{$ms.ms}</div>	
				</volist>   
			</div>
	<ul class="gpslist">
		<volist name="apt" id="apt"  key="$key" >	
			<li class="link" link="{:U('Apt/show')}?id={$apt.id}">
			<img src="{$apt.src}"/>
			<div class="ce">
				<span>
				<div class="font_1">{$apt.name}</div>
				<div  class="font_2"><div class="font_2_txt">{$apt.map}</div>
				<div class="font_2_bg"></div>
				</div>
				</span>
			</div>
			</li>
		</volist>   
	</ul>	
	</div>
 
</body>

</html>








